package com.fx.controller;


import com.fx.demo.common.resulUtils.AjaxResult;
import com.fx.dto.Student;
import com.fx.utils.FeignProviderClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collection;

@RestController
@RequestMapping("/hystrix")
public class MyHystrixController {
    @Autowired(required = false)
    private FeignProviderClient feignProviderClient;

    @GetMapping("/findAll")
    public AjaxResult<Collection<Student>> findAll(){
        return feignProviderClient.findAll(0,10);
    }

    @GetMapping("/index")
    public String index(){
        return feignProviderClient.getPort();
    }
}